package org.cytoscape.myapp.cytoscape_app_v1.internal.UI;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JButton;
import javax.swing.JLayeredPane;
import java.awt.Panel;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.UIManager;
import javax.swing.border.TitledBorder;

import org.cytoscape.myapp.cytoscape_app_v1.internal.model.NetworkSettings;
import org.cytoscape.myapp.cytoscape_app_v1.internal.model.UtilNetworkManager;
import org.cytoscape.work.TaskManager;

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class VisualLayoutOption extends JFrame {

	private JPanel contentPane;
	private NetworkSettings networkSettings;
	private TaskManager taskManager;


	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					VisualLayoutOption frame = new VisualLayoutOption();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 * @param taskManager 
	 * @param currentNetworkSUID 
	 * @param utilNetworkManager 
	 */
	public VisualLayoutOption(final NetworkSettings networkSettings, final TaskManager taskManager) {
		this.networkSettings = networkSettings;
		this.taskManager = taskManager;
		
		setTitle("Visual Options");
		setBounds(100, 100, 324, 336);
		contentPane = new JPanel();
		contentPane.setToolTipText("");
		contentPane.setBorder(null);
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JComboBox comboBoxWidth = new JComboBox();
		comboBoxWidth.setBounds(116, 22, 138, 20);
		contentPane.add(comboBoxWidth);
		
		JComboBox comboBoxColor = new JComboBox();
		comboBoxColor.setBounds(116, 53, 138, 20);
		contentPane.add(comboBoxColor);
		
		JComboBox comboBoxLenght = new JComboBox();
		comboBoxLenght.setBounds(116, 84, 138, 20);
		contentPane.add(comboBoxLenght);
		
		JLabel lblNewLabel = new JLabel("Lenght Edge");
		lblNewLabel.setBounds(26, 87, 71, 14);
		contentPane.add(lblNewLabel);
		
		JLabel lblWid = new JLabel("Width Edge");
		lblWid.setBounds(26, 25, 62, 14);
		contentPane.add(lblWid);
		
		JLabel lblColorEdge = new JLabel("Color Edge");
		lblColorEdge.setBounds(26, 56, 62, 14);
		contentPane.add(lblColorEdge);
		
		JButton btnDoLayout = new JButton("Do Layout");
		btnDoLayout.setBounds(163, 264, 116, 23);
		contentPane.add(btnDoLayout);
		
		btnDoLayout.addActionListener(new ActionListener() {
			
			public void actionPerformed(ActionEvent e) {
				taskManager.execute(networkSettings.getTaskIteratorLayout());
			}
		});
		
		JPanel panel = new JPanel();
		panel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Layout Options", TitledBorder.LEFT, TitledBorder.TOP, null, null));
		panel.setBounds(10, 129, 270, 103);
		contentPane.add(panel);
	}

	public VisualLayoutOption() {
		// TODO Auto-generated constructor stub
	}
}
